// test
const path = require('path')

const port = 8080 // 端口s

function resolve(dir) {
  return path.join(__dirname, './', dir)
}
module.exports = {
  outputDir: '../src/main/resources/static',
  publicPath: "./",
  devServer: {
    host: '0.0.0.0',
    port: port,
    open: true,
    proxy: {
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      ['/codes']: {
        target: `http://localhost:7111`,
        changeOrigin: true,
        pathRewrite: {
          ['^/codes'] : '/codes'
        }
      }
    },
    disableHostCheck: true,
    historyApiFallback: true
  },
  chainWebpack: config => {
    config.module
      .rule('svg')
      .exclude.add(resolve('src/assets/icons'))
      .end();

    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/assets/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'myicon-[name]'
      });
  }
}
